#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import nmap


def pylat(IP,Data,dados):
    print "Aqui latex",dados
    lat = """
\documentclass[a4paper,11pt]{report}
%\usepackage{classicthesis}
\usepackage[portuges]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx}           % Insert image files (library)
\usepackage[absolute]{textpos}  % Posicionamento de texto
\date{2013}
\\title{Relatório}
\\author{Luís Filipe Reis (12829)}

\\begin{document}

\\thispagestyle{empty}
\\begin{titlepage}
  \\vspace*{2cm}
  \\baselineskip=24pt

  \\textblockorigin{-18pt}{-2pt}
  \\begin{textblock*}{10cm}(2cm,1cm)
    \includegraphics[width=3.5cm]{images/LOGO_IPB.png}
  \end{textblock*}

  \\textblockorigin{-18pt}{-2pt}
  \\begin{textblock*}{10cm}(15cm,1cm)
    \includegraphics[width=3.5cm]{images/LOGO_ESTIG.png}
  \end{textblock*}

  \\textblockorigin{-18pt}{-2pt}
  \\begin{textblock*}{18cm}(2.0cm,2.7cm)
    \centering
      \\fontsize{13}{10}
      \usefont{OT1}{cmr}{m}{n}
      \\textbf{{INSTITUTO POLITÉCNICO DE BEJA}}
  \end{textblock*}

  \\textblockorigin{-18pt}{-2pt}
  \\begin{textblock*}{18cm}(2cm,3.4cm)
    \centering
      \\fontsize{13}{14}
      \usefont{OT1}{cmr}{m}{n}
      \\textbf{{Escola Superior de Tecnologia e Gestão}}
  \end{textblock*}

   \\textblockorigin{0cm}{0cm}
   \\begin{textblock*}{16cm}(2.5cm,4cm)
     \centering
      \\fontsize{13}{14}
      \usefont{OT1}{cmr}{m}{n}
       \\textbf{Mestrado em Engenharia da Segurança Informática}
   \end{textblock*}

   \\textblockorigin{0cm}{5cm}
   \\begin{textblock*}{16cm}(2.5cm,5.5cm)
     \centering
      \\fontsize{16}{16}
      \usefont{OT1}{cmr}{m}{n}
       \\textbf{{Relatório de PortScan}}
   \end{textblock*}

   \\textblockorigin{0cm}{5cm}
   \\begin{textblock*}{16cm}(2.5cm,7cm)
     \centering
      \\fontsize{14}{14}
      \usefont{OT1}{cmr}{m}{n}
       \\textbf{{"""
    lat="{0}{1}".format(lat,IP)
    lat = lat + """}}
   \end{textblock*}



   \\textblockorigin{0cm}{5cm}
   \\begin{textblock*}{16cm}(2.5cm,15cm)
     \centering
      \\fontsize{12}{12}
      \usefont{OT1}{cmr}{m}{n}
       \\textbf{{Elaborado por: \\\\}}
       \\textbf{{ \\\\
                  Lu{\' i}s Filipe Reis (12829)\\
                  Paulo Viegas (12834)}}
   \end{textblock*}

   \\textblockorigin{0cm}{5cm}
   \\begin{textblock*}{16cm}(2.5cm,18cm)
     \centering
      \\fontsize{12}{12}
      \usefont{OT1}{cmr}{m}{n}
       \\textbf{{  \\
                  Docente: \\
                  Professor Doutor Jos{\' e} Jasnau Caeiro}}
   \end{textblock*}


   \\textblockorigin{0cm}{5cm}
   \\begin{textblock*}{16cm}(2.5cm,21.2cm)
     \centering
      \\fontsize{14}{14}
      \usefont{OT1}{cmr}{m}{n}
       \\textbf{BEJA}
   \end{textblock*}

   \\textblockorigin{0cm}{5cm}
   \\begin{textblock*}{16cm}(2.5cm,22.2cm)
     \centering
      \\fontsize{14}{14}
      \usefont{OT1}{cmr}{m}{n}
       \\textbf{"""
    lat = "{0}{1}".format(lat,Data)
    lat = lat + """}
   \end{textblock*}
    \\newpage"""

    for x in dados:
        k = " {0} \\newline".format(x)   
        lat = "{0}{1}".format(lat,k)

    lat = lat + """
\end{titlepage}
\end{document}
%%
%% capa.tex
%% 
%% Made by  Luís Filipe Reis
%%          Paulo Viegas
"""

    return lat
